home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5396 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  63 lines

  1. Path: airdmhor.gen.nz!brage
  2. From: brage@PROBLEM_WITH_INEWS_DOMAIN_FILE (Aaron Hicks)
  3. Newsgroups: comp.lang.c++
  4. Subject: Help with svgalib and arrays.
  5. Date: 4 Feb 1996 05:06:44 GMT
  6. Organization: Airdmhor
  7. Message-ID: <4f1et4$vdr@airdmhor.gen.nz>
  8. NNTP-Posting-Host: airdmhor.gen.nz
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. I need help with a so far primitive graphic application, so far all my
  12. program does is refresh an array to the screen. My problem is that the
  13. refresh rate is abysmal, about 1.5 frames per second and all it's doing is
  14. displaying the array to the screen, I've tried it in both G640x480x256 and
  15. G320x200x256 and has the same frame rate. This, as far as I can tell, means
  16. that my problem is not with the way I'm displaying the stuff to the screen,
  17. but with the way I'm retrieving the data from the array.
  18.  
  19. I'm using GCC under Linux (the November 1995 Infomagic release), the card is
  20. a Diamond Stealth 64 Video VRAM, with 2MB on board, the computer is a 486DX4
  21. 100 MHz with 16Mb of memory.
  22.  
  23. Currently the bits of the program that I find unsatisfactory are...
  24.  
  25. class dbit {
  26.     int terra,aqua,aura,ether;
  27. public:
  28.     int colour();
  29. };
  30.  
  31. int dbit::colour()
  32. {
  33.     return (terra);// soon to be replaced by some function of terra
  34. };
  35.  
  36. class world {
  37.     dbit maploc[639][479];
  38. public:
  39.     void show();
  40. };
  41.  
  42. void world::show()
  43. {    
  44.     for(y=0;y<=479;y=y+1);{
  45.         for(x=0;x<=639;x=x+1)
  46.             gl_setpixel(x,y,maploc[x][y].colour());
  47.         };
  48. };
  49.  
  50. The slow bit seems to be the function world.show(). Main simply sets up the
  51. display in G640x480x256 and a virtual screen and gl_copyscreens the
  52. virtual to the physical.
  53.     
  54.  
  55.  
  56. --
  57. ###################################################################
  58. # A message from Bloodrage, (brage@airdmhor.gen.nz), the home of  #
  59. # MegaBBS and Realms of Insanity BBS. Christchurch, New Zealand.  #
  60. #                    The truth is out there.                      #
  61. ###################################################################
  62.  
  63.